<%-- internal/maintain/food-item/index.jsp --%>

<?xml version="1.0" encoding="UTF-8"?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="problemDomain.EmployeeAccountBean, problemDomain.EmployeeAccountBean.Position" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<%

//get the currently logged on employee from session
EmployeeAccountBean employee = (EmployeeAccountBean)session.getAttribute("employee");
EmployeeAccountBean.Position pos = null;
if (employee != null)
	pos = employee.getPosition();
else {
	response.sendRedirect("../../login/");
	return;
}

if (pos != Position.MANAGER) {
	response.sendRedirect("../../login/");
	return;
}

%>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<link type="text/css" rel="stylesheet" href="../../css/general.css" />
		<link type="text/css" rel="stylesheet" href="../../css/framed.css" />
		<script type="text/javascript" src="../../js/ajax-handler.js"></script>
		<script type="text/javascript" src="../../js/form.js"></script>
		<script type="text/javascript" src="../../js/dialog.js"></script>
		<script type="text/javascript" src="../../js/food-item/maintain.js"></script>
		<script type="text/javascript" src="../../js/food-item/form.js"></script>
		<title>ORDRS - Maintain Food Item</title>
	</head>
	<body onload="loadPage()">
		<!-- Title -->
			<div class="pageTitle">
				<img src="../../images/logo.bmp" />
				<!-- Logout -->
				<div class="navi">
					<table class="navi" align="right">
						<tr>
						<%
						out.println("<td class=\"navi\"><a href=\"../delivery/\">Delivery</a></td>");
						out.println("<td class=\"navi\"><a href=\"../food-item/\">Food Item</a></td>");
						out.println("<td class=\"navi\"><a href=\"../employee/\">Employee</a></td>");
						out.println("<td class=\"navi\"><a href=\"../menu-item/\">Menu Item</a></td>");
						out.println("<td class=\"navi\"><a href=\"../menu/\">Order</a></td>");
						out.println("<td class=\"navi\"><a href=\"../../view/report/\">Report</a></td>");
						out.println("<td class=\"navi\"><a href=\"../reservation/\">Reservation</a></td>");
						%>
							
							<td class="navi"><a href="../../login/">Logout</a></td>
						</tr>
					</table>
				</div>
				<!-- END Logout -->
			</div>
			<!-- END Title -->	
		
		<!-- Panel -->
		<div class="panel">
		<fieldset>
		<legend>Maintain Food Item</legend>
			<table style="border: 0px; width: 100%">
				<tr style="height: 100%">
					<td rowspan="2">
						<!-- Fields -->
						<div class="fields">
							<input id="foodItemId" type="hidden" value="" />
							<table>
								<tr>
									<td>Name:</td>
									<td><input id="foodItemName" type="text" /></td>
									<td id="foodItemNameMessage"></td>
								</tr>
								<tr>
									<td>Description</td>
									<td><input id="foodItemDescription" type="text" /></td>
									<td id="foodItemDescriptionMessage"></td>
								</tr>
								<tr>
									<td>Cost:</td>
									<td><input id="foodItemCost" type="text"  maxlength="9"/></td>
									<td id="foodItemCostMessage"></td>
								</tr>
								<tr>
									<td>Type:</td>
									<td>
										<select id="foodItemType" onchange="showHideInputBox()">
										<option value="" selected="selected"></option>
										<optgroup id="foodItemTypeOptGroup" label="Types">
										</optgroup>
										<option value="new">New...</option>
										</select>
										<input id="foodItemNewType" style="display: none;" type="text" />
									</td>
									<td id="foodItemTypeMessage"></td>
								</tr>
								<tr>
									<td>Available:</td>
									<td>
										<form id="foodItemAvailable">
											<input type="radio" name="availRadio" value="1" checked="checked" />Available
											<input type="radio" name="availRadio" value="0" />Unavailable
											<input type="radio" name="availRadio" value="-1" />Don't search
										</form>
									</td>
								</tr>
							</table>
						</div>
						<!-- END Fields -->
					</td>
					<td rowspan="2" class="vrule"></td>
					<td class="resultsHead">Results</td>
				</tr>
				<tr>
					<td class="resultsTD">
						<!-- Results -->
						<div id="results" class="results">
						</div>
						<!-- END Results -->
					</td>
				</tr>
				<tr>
					<td>
						<!-- Toolbar -->
						<ul class="toolbar">
							<li onclick="createFoodItem()">Create</li>
							<li onclick="reportFoodItem()">Search</li>
							<li onclick="updateFoodItem()">Update</li>
							<li onclick="deleteFoodItem()">Delete</li>
							<li onclick="resetFields()">Clear</li>
						</ul>
						<!-- END Toolbar -->
					</td>
					<td></td>
					<td class="alignRight">
						<!-- List All Button -->
						<ul class="toolbar">
							<li onclick="listAllFoodItem()">List All</li>
						</ul>
					</td>
				</tr>
			</table>
		</fieldset>
		</div>
		<!-- END Panel -->
	</body>
</html>
